package com.yjhb.android.sbz.mvp.mypromotionfriend;

import com.yjhb.android.sbz.entity.LevelUser;
import com.yjhb.android.sbz.entity.ResultSet;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

/**
 * 创建者 zx
 * 创建时间 2020/12/30 14:54
 */
public class MyPromotionFriendPresenter extends ConventionPresenter<MyPromotionFriendView> {
    private final String TAG = "MyPromotionFriendPresenter";

    @Override
    protected void onDestroy() {

    }

    public MyPromotionFriendPresenter(MyPromotionFriendView myPromotionFriendView) {
        super(myPromotionFriendView);
    }


    /**
     *
     * @param type
     */
    public void getRelationFriend(Integer type,String friendId,int size,int current){
        HttpTool.request(model.getRelationFriend(type,friendId,size,current), new HttpObserver<ResultSet<LevelUser>>() {
            @Override
            public void onResult(ResultSet<LevelUser> data) {
                if (view!=null){
                    if (current ==1){
                        view.onRefresh(data.getRecords());
                    }else {
                        view.onLoad(data.getRecords());
                    }
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view!=null){
                    view.onFailure(code, msg);
                }
            }
        });

    }


}
